import ReactDOM from "react-dom/client";
import App from "./App.jsx";
import defineMaps from "../config/defineMaps.js";
import { startLoading, endLoading } from "@/utils/loading.jsx";
import './questionComp/jd.js';
import "antd/dist/antd.less";

//运行的环境变量
const mode = import.meta.env.MODE;

window.API_SERVER = defineMaps[mode].API_SERVER;
window.UPLOAD_SERVER = defineMaps[mode].UPLOAD_SERVER;
window.GOODS_HREF = defineMaps[mode].GOODS_HREF;
window.AUTHORIZE_URL = defineMaps[mode].AUTHORIZE_URL;
window.ZFB_URL = defineMaps[mode].ZFB_URL;
window.PAY_CALLBACK_URL = defineMaps[mode].PAY_CALLBACK_URL;
window.QI_NIU_IMG_UPLOAD = defineMaps[mode].QI_NIU_IMG_UPLOAD;
window.APP_TITLE = __APP_TITLE__;
window.INDUSTRIAL_BELT_FLAG = __INDUSTRIAL_BELT_FLAG__;
window.START_LOADING = startLoading;
window.END_LOADING = endLoading;

window.addEventListener('vite:preloadError', (event) => {
  // 例如，刷新页面
  window.location.reload() 
})

ReactDOM.createRoot(document.getElementById("root")).render(<App />);
